#ifndef VMVALUE_H
#define VMVALUE_H

#include "VMType.h"

namespace CuteVM {

    class Value; // forward

    class ValueHolder {
    private:
        Value * value;
    public:
        ValueHolder(Value * value) {
            this->value = value;
        }

        Value * getValue() {
            return value;
        }
    };

    class Value {
    public:
           virtual TypeId getType() = 0;
           virtual QString toString() = 0;
    };

    class ValueVoid {
    public:
        ValueVoid() {}
        TypeId getType() {
            return TypeId(QString("cute/core"),QString("Void"));
        }
        QString toString() { return QString("()"); }
    };

    class NoValue {
    public:
        NoValue() {}
        TypeId getType() {
            return TypeId(QString("cute/core"),QString("NoValue"));
        }
        QString toString() { return QString(""); }
    };

    class BoolValue {
    private:
        bool val;
    public:
        BoolValue(bool val) : val(val) {}
        bool isTrue() { return val; }
        TypeId getType() {
            return TypeId(QString("cute/core"),QString("Bool"));
        }
        QString toString() { if(val) return QString("true"); else return QString("false"); }
    };

    class IntValue {
    private:
        int val;
    public:
        IntValue(int val) : val(val) {}
        int getNum() { return val; }
        TypeId getType() {
            return TypeId(QString("cute/core"),QString("Int"));
        }
        QString toString() { return QString(val); }
    };

    class StringValue {
    private:
        QString str;
    public:
        StringValue(QString str) : str(str) {}
        QString getString() { return str; }
        TypeId getType() {
            return TypeId(QString("cute/core"),QString("String"));
        }
        QString toString() { return str; }
    };

} // namespace CuteVM

#endif // VMVALUE_H
